<template>
  <div class="wrapper">
    <div class="pay-wrap">
      <div class="order-result">
        <div class="section clearfix">
          <img :src="data.orderImg" class="ico" />
          <div class="titbox">
            <div class="tit">订单提交成功，应付金额 {{data.orderPrice}} 积分</div>
            <div class="stit">订单号：{{data.orderId}} </div>
          </div>
          <div class="mt20">
            <div class="meta">
              <div class="hd">收货地址</div>
              <div class="bd">{{data.userAddress}}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom-panel">
      <a @click="payOrder" class="go-next ui-btn-theme">支付</a>
    </div>
  </div>
</template>
<script>
import http from '../../../base/api/http'
export default {
  name: 'PayWrapper',
  data () {
    return {
      data: {
        orderId: null,
        userAddress: null,
        orderImg: null,
        orderPrice: null
      }
    }
  },
  methods: {
    getOrder (id) {
      http.requestGet('/java/api/order/getPayOrder', {
        'id': id
      }).then((res) => {
        if (res.status === 0) {
          this.data = res.data
        }
      })
    },
    payOrder () {
      http.requestGet('/java/api/pay/payOrder', {
        'orderId': this.data.orderId
      }).then((res) => {
        if (res.status === 0) {
          this.$router.push({path: '/payOk'})
        } else {
          alert(res.msg)
        }
      })
    }
  },
  mounted () {
    let orderId = this.$route.query.orderId
    this.getOrder(orderId)
  }
}
</script>
<style>
</style>
